from django.db.models.signals import pre_delete
from django.dispatch import receiver
from apps.users.models import Image

# 将文件删除
@receiver(pre_delete, sender=Image)
def image_delete(instance, **kwargs):
    """

    :param sender: 文件字段所在的类
    :param instance: 模型对象
    :param kwargs:
    :return:
    """
    instance.images.delete(False)
